/**
 * @file clientHandler.h
 * @author your name (you@domain.com)
 * @brief 
 * @version 0.1
 * @date 2024-07-20
 * 
 * @copyright Copyright (c) 2024
 * 
 */

#pragma once

#include <string>
#include <atomic>
#include <vector>

#include "httpSvr/router.h"

namespace wheels
{

class HttpHandler
{
public:
    explicit HttpHandler(std::shared_ptr<IRouter> r): m_router(r) {}
    ~HttpHandler() =default;

    int OnHandleClient(int cliFd, std::string clientAddr);

private:
    void HandleRequest(int cliFd, std::string clientAddr);

    std::string GetLine(int fd);

private:
    static const int MaxLinkNum = 8;
    std::atomic<int> m_count = 0;
    std::shared_ptr<IRouter> m_router;
};

} // namespace wheels
